/*
 * @(#)ConnectorUtil.java $version 2010. 8. 11
 *
 * Copyright 2007-2010 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.nhncorp.usf.core.util;

import java.util.Locale;

/**
 * @author Web Platform Development Team
 */
public class ConnectorUtil {
    /**
     * the enum protocol
     */
    public static enum UraScheme {
        /*
        * You need to change two classes; UraName and UraInvoker, when you are
        * trying to add a protocol.
        */
        LUCY;
    }


    /**
     * Parses the.
     *
     * @param address the address
     * @return the ura name
     * @throws Exception the ura syntax exception
     */
    public static Object[] parse(String address) throws Exception {
        int sep = address.trim().indexOf("://");

        if (sep < 3) {
            throw new Exception("Invalid protocol namespace. (ex: lucy://");
        }

        UraScheme scheme = UraScheme.valueOf(address.trim().substring(0, sep).toUpperCase(Locale.US));
        String subUra = address.substring(sep + 3);

        return new Object[] {scheme, subUra};
    }
}
